Carbon


HDelete

Header: Files.h Carbon status: Supported

Deletes a file or directory.

OSErr HDelete (
    SInt16 vRefNum, 
    SInt32 dirID, 
    ConstStr255Param fileName
);
vRefNum

A volume specification (a volume reference number, a working directory reference number, or 0 for the default volume).

dirID

The directory ID of the parent of the file or directory to delete.

fileName

The name of the file or directory to delete.

function result

A result code.

DISCUSSION

If the specified target is a file, both forks of the file are deleted. In addition, if a file ID reference for the specified file exists, that reference is removed.

A file must be closed before you can delete it. Similarly, you cannot delete a directory unless it’s empty. If you attempt to delete an open file or a nonempty directory, HDelete returns the result code fBsyErr. HDelete also returns the result code fBsyErr if the directory has an open working directory associated with it.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)